$ () ->
	$("#selectType").change (e) ->
		# console.log window.location.host
		window.location.href = window.location.pathname + "?&ct_type_id=" + $("#selectType").val()

	$(".delete_btn").click (e) ->
		param =
			id: $(this).children(".delete_id").val()

		message = confirm "是否确认删除"
		if message is true
			$.post "/api/admin/commodity/delete-commodity",param, (res) ->
				if res.status.errCode is 0
					alert "删除成功"
					window.location.reload()
				else
					alert res.status.message
